import { notFound } from 'next/navigation'; import { allPosts } from 'contentlayer/generated'; import Mdx from '@/components/MDX'; interface PageProps { params: { slug: string } } async function getPageFromParams(params) { const slug = params?.slug, page = allPosts.find((page) => page.slugAsParams === slug); if (!page) { null; } return page; } export async function generateStaticParams(): Promise { return allPosts.map((page) => ({ slug: page.slugAsParams, })); } export default async function PostPage({ params }: PageProps) { const post = await getPageFromParams(params); if (!post) { notFound(); } return ( <> {post && post.title && (
{post.product}

{post.title}

)}
{post.description &&

{post.description}

}
); }